<%-- 
  - Author: Mohtisham.Salahria
  - Date: 11-Apr-2011
  - Copyright Notice: TRAKHEES
  - Description: form.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>
<script type="text/javascript">
	$().ready(function() {
		
		//$( "input:submit, input:reset, input:button, .view").button();
		
		$("#fm-form").validate({
			onfocusout : false,
			onkeyup : false,
			//onclick: false,			
			rules : {
				strActionType : "required",
				strComments : "required"				
			},

			showErrors : function(errorMap, errorList) {

				var errors = '<ul>';
				var label;
				if (errorList.length) {
					$.each(errorMap, function(name, value) {
						label = $("label[for='" + name + "']").html();
						label = value + '[' + label + ']';
						errors = errors + '<li>' + label + '</li>';

					});
					errors = errors + '</ul>';
					jAlert('error', errors, 'Error Validating Form');
				}
			}

		});
		$("input[name='close']").click(function(){ 
			window.location.href='${pageContext.request.contextPath}<%=ViewPath.USER_INTERNAL_TRAKHEES_STAFF_INBOX%>/<%=PageType.LIST.getPageType()%>.htm';
		});
       
});

		
		$(function() {			
			$( "#accordion" ).accordion();				
	});
		
		
</script>
<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>'>

	<form:form name="CompanyRegisInfo" id="CompanyRegisInfo" method="POST"
		modelAttribute="<%=ConstantsAdmin.NON_CLIENT_COMPANY_REGISTRATION_ADMIN_REVIEW_REQUEST_MODEL_KEY %>">

		<div id=accordion>
			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message code="label.company.license" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<div class="fm-req">
					<form:label path="iClientRole">
						<spring:message code="label.company.role" />
					</form:label>
					<%--  <c:out value="${nonClientCompanyRegistrationAdminReview.strRoleDisplay}" />
		       <br/>
		       --%>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<div style="display: block;" class="float">
								<c:forEach var="roles"
									items='${fn:split(nonClientCompanyRegistrationAdminReview.strClientRoleAr,",")}'>
									<c:out value="${roles}" />
									<br>
								</c:forEach>
							</div>
						</c:when>
						<c:otherwise>
							<div style="display: block;" class="float">
								<c:forEach var="roles"
									items='${fn:split(nonClientCompanyRegistrationAdminReview.strClientRoleEn,",")}'>
									<c:out value="${roles}" />
									<br>
								</c:forEach>
							</div>
						</c:otherwise>
					</c:choose>


				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCompNameEng">
						<spring:message code="label.company.nameeng" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strCompNameEng}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCompNameArab">
						<spring:message code="label.company.namearab" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strCompNameArab}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCompNameArab">
						<spring:message code="label.client.category" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strCategoryDescAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strCategoryDescEn}" />
						</c:otherwise>
					</c:choose>


					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="iLicenseIssuingAuth">
						<spring:message code="label.company.lia" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strLicenseIssuingAuthDescAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strLicenseIssuingAuthDescEn}" />
						</c:otherwise>
					</c:choose>

					<br />
				</div>

				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strLicenseNumber">
						<spring:message code="label.company.lno" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strLicenseNumber}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="iLicenseType">
						<spring:message code="label.company.lictype" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strLicenseTypeDescAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strLicenseTypeDescEn}" />
						</c:otherwise>
					</c:choose>


					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strLicenseIssueDate">
						<spring:message code="label.company.lid" />
					</form:label>
					<fmt:formatDate pattern="dd/MM/yyyy"
						value="${nonClientCompanyRegistrationAdminReview.strLicenseIssueDate}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strLicenseExpiryDate">
						<spring:message code="label.company.led" />
					</form:label>
					<fmt:formatDate pattern="dd/MM/yyyy"
						value="${nonClientCompanyRegistrationAdminReview.strLicenseExpiryDate}" />
					<br />
				</div>
				<div style="clear: both"></div>

			</div>
			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message code="label.contact.location" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<div class="fm-req">
					<form:label path="strPObox">
						<spring:message code="label.company.poboxnumber" />
					</form:label>
					<c:out value="${nonClientCompanyRegistrationAdminReview.strPObox}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strPOBoxLoc">
						<spring:message code="label.company.poboxlocation" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strPOBoxLoc}" />
					<br />
				</div>

				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strOfficeNo">
						<spring:message code="label.company.telnooffice" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strOfficeNo}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strFaxNo">
						<spring:message code="label.company.faxnooffice" />
					</form:label>
					<c:out value="${nonClientCompanyRegistrationAdminReview.strFaxNo}" />
					<br />
				</div>

				<div style="clear: both"></div>
				<div>
					<form:label path="strWebsiteURL">
						<spring:message code="label.company.websiteurl" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strWebsiteURL}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strEmailAddress">
						<spring:message code="label.company.emailaddress" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strEmailAddress}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strAddressEng">
						<spring:message code="label.company.addresseng" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strAddressEng}" />
					<br />
				</div>
				<div style="clear: both"></div>

				<div class="fm-req">
					<form:label path="strAddressArb">
						<spring:message code="label.company.addressarab" />
					</form:label>
					<c:out
						value="${nonClientCompanyRegistrationAdminReview.strAddressArb}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCity">
						<spring:message code="label.nonclient.person.register.city" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strCityNameAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strCityNameEn}" />
						</c:otherwise>
					</c:choose>
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCountry">
						<spring:message code="label.nonclient.person.register.country" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strCountryNameAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientCompanyRegistrationAdminReview.strCountryNameEn}" />
						</c:otherwise>
					</c:choose>
					<br />
				</div>
				<div style="clear: both"></div>

			</div>
			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message
						code="label.nonclient.person.register.documents.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<div class="t_fin-black-txt">
				<div class="fm-req">
					<table border="0">
						<c:forEach items="${adminActionHistory.uploadDocumentVOs}"
							var="docs" varStatus="loop">
							<tr>
								<c:choose>
									<c:when test="${docs.strUploadDocumentType == 'LIC'}">
										<td><spring:message code="label.company.licensecopy" />
										</td>
										<td width="10px"></td>
										<td><a href="file/download.htm?fileId=${docs.lFileId}"
											class="view"><spring:message
													code="label.user.request.view" />
										</a>
										</td>
									</c:when>
									<c:otherwise>
										<td><spring:message
												code="label.company.managerpassportcopy" />
										</td>
										<td width="10px"></td>
										<td><a href="file/download.htm?fileId=${docs.lFileId}"
											class="view"><spring:message
													code="label.user.request.view" />
										</a>
										</td>
									</c:otherwise>
								</c:choose>
							</tr>
						</c:forEach>
					</table>
				</div>
			</div>


			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message code="label.actionhistory" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<table style="width: 100%" class="t_grid-table">
					<tr class="ui-jqgrid-labels">
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.date" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.user" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.type" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.department" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.comments" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.register.user.notification" />
						</td>
					</tr>
					<c:choose>
						<c:when test="${empty adminActionHistory.stepActionVOs}">
							<tr>
								<td colspan="6" align="center"><spring:message
										code="msg.no.actions.found" /></td>
							</tr>
						</c:when>
						<c:otherwise>
							<c:forEach items="${adminActionHistory.stepActionVOs}"
								var="actions" varStatus="loop">
								<tr>
									<td><fmt:formatDate pattern="dd/MM/yyyy"
											value="${actions.actionDate}" />
									</td>
									<td><c:out value="${actions.strActionUser}"></c:out>
									</td>
									<td><c:choose>
											<c:when test="${actions.strActionType == 'I' }">
												<spring:message code="msg.workflow.status.in.progress" />
											</c:when>
											<c:when test="${actions.strActionType == 'A' }">
												<spring:message code="msg.workflow.status.approved" />
											</c:when>
											<c:when test="${actions.strActionType == 'R' }">
												<spring:message code="msg.workflow.status.rejected" />
											</c:when>
										</c:choose></td>
									<c:forEach items="${adminActionHistory.commentsVOs}"
										var="comments" varStatus="commentloop">
										<c:if
											test="${actions.processStep.processStepCode == comments.processStep.processStepCode}">
											<c:if
												test="${registerAdminReview.strStepName ==  comments.processStep.processStepCode}">
												<c:set property="strApplnStatus"
													target="${adminActionHistory}" value="DEPT_ACTED"></c:set>
											</c:if>
											<c:choose>
												<c:when
													test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
													<td><c:out
															value="${comments.processStep.processStepDescAr}"></c:out>
													</td>
												</c:when>
												<c:otherwise>
													<td><c:out
															value="${comments.processStep.processStepDescEn}"></c:out>
													</td>
												</c:otherwise>
											</c:choose>
											<td><c:out value="${comments.strComments}"></c:out>
											</td>
											<td><c:out value="${comments.strCommentsUser}"></c:out>
											</td>
										</c:if>
									</c:forEach>
								</tr>
							</c:forEach>
						</c:otherwise>
					</c:choose>
				</table>
			</div>
			<div style="clear: both"></div>
		</div>
		<form:hidden path="strApplicationId" />

	</form:form>
	<c:choose>
		<c:when test="${adminActionHistory.strApplnStatus == 'DEPT_ACTED' }">
			<div style="clear: both">
				<br />
			</div>
			<div class="fm-req">
				<label><b><spring:message
							code="client.register.application.status" />
				</b>
				</label>
				<c:choose>
					<c:when
						test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
						<c:out value="${adminActionHistory.strStatusAr}" />
					</c:when>
					<c:otherwise>
						<c:out value="${adminActionHistory.strStatusEn}" />
					</c:otherwise>
				</c:choose>
			</div>
		</c:when>
		<c:when test="${adminActionHistory.strApplnStatus == 'I' }">
			<form:form name="fm-form" id="fm-form" method="POST"
				modelAttribute="<%=ConstantsAdmin.REGISTER_ADMIN_REVIEW_REQUEST_MODEL_KEY %>">
				<spring:hasBindErrors
					name="<%=ConstantsAdmin.REGISTER_ADMIN_REVIEW_REQUEST_MODEL_KEY %>">
					<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'Error Validating Form');
								});
			</script>
				</spring:hasBindErrors>
				<%
					if (request.getAttribute(ConstantsAdmin.SUCCESS_PARAM) != null) {
				%>
				<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'success','<%=request
									.getAttribute(ConstantsAdmin.SUCCESS_PARAM)%>
					',
												'<spring:message code="msg.success" />');
										window.opener = 'x';
										window.close();
									});
				</script>
				<%
					}
				%>

				<div style="clear: both"></div>
				<fieldset>
					<legend>
						<spring:message code="label.admin.action" />
					</legend>
				</fieldset>
				<div style="clear: both"></div>
				<br />
				<div class="t_form-left t_fin-black-txt">
					<div class="fm-req">
						<form:label path="strActionDate">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.date" />
						</form:label>
						<form:input path="strActionDate" id="strActionDate" size="20"
							maxlength="100" readonly="true" />
					</div>
					<div class="fm-req">
						<form:label path="strUserName">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.user" />
						</form:label>
						<form:input path="strUserName" id="strUserName" size="20"
							maxlength="100" readonly="true" />
					</div>
					<div class="fm-req">
						<form:label path="strActionDate">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.type" />
						</form:label>
						<c:choose>
							<c:when
								test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<form:select path="strActionType"
									items="${nonClientPersonRegisterActionTypeList}"
									id="strActionType" itemLabel="labelAr" itemValue="id"
									cssStyle="width:154px;" class="fm-opt" />
							</c:when>
							<c:otherwise>
								<form:select path="strActionType"
									items="${nonClientPersonRegisterActionTypeList}"
									id="strActionType" itemLabel="labelEn" itemValue="id"
									cssStyle="width:154px;" class="fm-opt" />
							</c:otherwise>
						</c:choose>
					</div>
					<div class="fm-req">
						<form:label path="strComments">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.comments" />
						</form:label>
						<form:textarea path="strComments" id="strComments" size="20"
							maxlength="100" style="width:190px;height:100px;" class="fm-opt" />
					</div>
					<div>
						<form:label path="strUserNotification">
							<spring:message code="label.register.user.notification" />
						</form:label>
						<form:textarea path="strUserNotification" id="strUserNotification"
							size="20" maxlength="100" style="width:190px;height:100px;"
							class="fm-opt" />
					</div>
					<div id="fm-submit" class="fm-req">

						<input type="submit" name="submit"
							value="<spring:message code="label.button.submit" />"
							class="t_btns submit" /> <input type="button" name="close"
							value="<spring:message code="label.button.close" />"
							class="t_btns submit" />

					</div>
				</div>

				<form:hidden path="strApplicationId" />
				<form:hidden path="strTaskId" />
				<form:hidden path="strIncidentNo" />
				<form:hidden path="strStepName" />
				<form:hidden path="department" />
			</form:form>
		</c:when>
		<c:otherwise>
			<div style="clear: both">
				<br />
			</div>
			<div class="fm-req">
				<label><b><spring:message
							code="client.register.application.status" />
				</b>
				</label>
				<c:choose>
					<c:when
						test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
						<c:out value="${adminActionHistory.strStatusAr}" />
					</c:when>
					<c:otherwise>
						<c:out value="${adminActionHistory.strStatusEn}" />
					</c:otherwise>
				</c:choose>
			</div>
		</c:otherwise>
	</c:choose>
</div>
